/*
 * @Author: 
 * @Date: 2021-02-12 15:42:01
 * @Last Modified by: 
 * @Last Modified time: 2022-04-02 19:22:11
 */
import Cookies from 'js-cookie';
import { getParentLocal } from '@/utils';

// 架构 cookie
export const getToken = (): string => getParentLocal('jwt').value ?? '';
export const setToken = (val: string) =>
  localStorage.setItem('jwt', JSON.stringify({ value: val }));

export const removeToken = (): void => localStorage.removeItem('jwt');
  // 更新token
// export const refreshToken = (val: string) =>
//   localStorage.setItem('jwt', JSON.stringify({ refreshToken: val }));


export const getUserInfo = () => getParentLocal('refreshToken');
export const setUserInfo = (val: Record<string, unknown>) =>
  localStorage.setItem('refreshToken', JSON.stringify(val));
export const removeUserInfo = (): void => localStorage.removeItem('refreshToken');


// export const getUserInfo = () => getParentLocal('userinfo');
// export const setUserInfo = (val: Record<string, unknown>) =>
//   localStorage.setItem('userinfo', JSON.stringify(val));
// export const removeUserInfo = (): void => localStorage.removeItem('userinfo');

// 业务 cookie
